package com.tzy.order;
import com.tzy.common.entity.User;
import com.tzy.order.service.HelloService;
import com.tzy.order.service.IHelloService;
import com.tzy.order.service.JavaProxyInvocationHandler;
import org.junit.jupiter.api.Test;

/**
 * 测试动态代理类
 */
//@SpringBootTest
public class MainJavaProxy {
    @Test
    void test(){
        JavaProxyInvocationHandler proxyInvocationHandler = new JavaProxyInvocationHandler(new HelloService());
        IHelloService helloService = (IHelloService) proxyInvocationHandler.newProxyInstance();

        User user = new User();
        user.setNickname("厚大法考");

        helloService.sayByeBye(user);
        helloService.sayHello(user);
    }
}
